package com.briup.day11;

/**
 * @author lining
 * @date 2024/1/22 14:09
 */
public class TestLocalClass {
    public static void main(String[] args) {
        //1.创建匿名内部类表示抽象类的子类
        AbsFather a = new AbsFather(){
            public void run() {
                System.out.println("实现run方法");
            }
        };
        System.out.println(a == null);
        System.out.println(a.getClass());//TestLocalClass$1
        a.run();
        //2.匿名内部类创建接口的实现类对象，实现接口
        Action a2 = new Action(){
            public void say() {
                System.out.println("say....");
            }
            public void speak() {
                System.out.println("speak....");
            }
        };
        System.out.println(a2.getClass());
        a2.say();
        a2.speak();
    }

}
abstract class AbsFather{
    public abstract void run();
}
interface Action{
    void say();
    void speak();
}